<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>Vue 源码解读</title>
</head>

<body>
  <div id="app">
    {{ msg }}
    <ttq></ttq>
  </div>
  <script src="../dist/vue.js"></script>
  <script>
    Vue.component('ttq', {
      data() {
        return {
          ttq: 'ttq'
        }
      },
      props: ['testprop'],
      template: '<p>hello {{ttq}}</p>'
    })
    const vm = new Vue({
      el: '#app',
      data: {
        msg: 123,
        obj: {
          a: 123
        },
        arr: [1, 2]
      },
      computed: {
        a() {
          return this.msg + 3
        }
      },
      watch: {
        msg: function (val, oldVal) {
          console.log('new: %s, old: %s', val, oldVal)
        }
      },
      methods: {
        go() {
          console.log(123)
        }
      }
    })


  </script>
</body>

</html>